import { Button, VerticalBox ,TextEdit, HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox, LineEdit} from "std-widgets.slint";
import {SelectableTableView} from "selectable_tree_view.slint";
import {LeftSidePanel} from "left_side_panel.slint";
import {MainList} from "main_lists.slint";
import {CurrentTab, ProgressToSend} from "common.slint";
import { ActionButtons } from "action_buttons.slint";
import { Progress } from "progress.slint";
import {MainListModel, SelectMode, SelectModel} from "common.slint";
import {Settings} from "settings.slint";
import {Callabler} from "callabler.slint";
import { BottomPanel } from "bottom_panel.slint";
import {ColorPalette} from "color_palette.slint";
import {GuiState} from "gui_state.slint";
import { Preview } from "preview.slint";

export component PopupMoveFolders inherits Rectangle {
    out property <length> popup_width: 500px;
    out property <length> popup_height: 150px;
    in-out property <string> folder_name: "";
    callback show_popup();

    popup_window := PopupWindow {
        width: popup_width;
        height: popup_height;

        close-policy: PopupClosePolicy.no-auto-close;
        Rectangle {
            width: parent.width;
            height: parent.height;
            border-radius: 5px;
            background: ColorPalette.popup_background;
            VerticalLayout {
                Text {
                    vertical-stretch: 0.0;
                    min-height: 30px;
                    text: "Moving files";
                    vertical-alignment: top;
                    horizontal-alignment: center;
                    font-size: 13px;
                }
                Text {
                    vertical-stretch: 1.0;
                    text: "Moving entries to folder\n" + folder_name + "\nAre you want to continue?";
                    vertical-alignment: center;
                    horizontal-alignment: center;
                    font-size: 13px;
                    padding: 10px;
                }

                VerticalLayout {
                    HorizontalLayout {
                        alignment: center;
                        copy_checkbox := CheckBox {
                            text: "Copy files instead of moving";
                        }
                    }
                    HorizontalLayout {
                        alignment: center;
                        preserve_folder_checkbox := CheckBox {
                            text: "Preserve folder structure";
                        }
                    }
                }

                HorizontalLayout {
                    Button {
                        text: "Yes";
                        clicked => {
                            popup_window.close();
                            Callabler.move_items(preserve_folder_checkbox.checked, copy_checkbox.checked, folder_name);
                        }
                    }
                    Rectangle {

                    }
                    Button {
                        text: "No";
                        clicked => {
                            popup_window.close();
                        }
                    }
                }
            }
        }
    }

    show_popup() => {
        popup_window.show();
    }
}